package com.zh.sharding.sale.entity;

import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 商品表
 * 分片规则：不分片
 * @author ZH
 * @date 09:17 2023/8/4
 */
@Data
public class Product implements Serializable {
    /**
     * 使用自定义ID
     */
    private Long id;
    private String name;
    private BigDecimal price;
    private Integer store;
    private LocalDateTime createTime;

    private Product(){}

    public Product(long id,String name,BigDecimal price,int store){
        Objects.requireNonNull(name);
        Objects.requireNonNull(price);
        this.id= id;
        this.name = name;
        this.price = price;
        this.store = store;
        this.createTime= LocalDateTime.now();
    }

}
